<?php
 require_once ("include.php");
 require_once ("registereduserobj.php");
 $id = @$_REQUEST['id'];
 if (ctype_alnum($id) && strlen($id)==32) {
  $sql = "select * from registereduser where confirmcode = '$id' and isactive = 'N'";
  $ans = sqlreadarray($sql);
 } else {
  $ans = '';
 }
 if (sizeof($ans) == 0) {
  echo noaccount();
 } else {
  echo setupaccount($ans,$id);
 }
 
 function noaccount() {
  $o = "<h1>Either that link does not lead anywhere or your account is already active</h1>";
	return $o;
 }
 
 function setupaccount($registereduseritem,$id) {
  $sql = "update registereduser set isactive = 'Y', activateddate = SYSDATE(),confirmcode = 'ISCONFIRMCODE' where confirmcode = '$id'";
	sqlexec($sql);
	$o = "<h1>Your account is now ready to use</h1>";
	return $o;
 }
 
?>
